<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="my"  uri="http://www.trkj.com/tr1702/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>题库</title>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/jquery.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/jquery.easyui.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/locale/easyui-lang-zh_CN.js"/>"></script>
<link id="theme" rel="stylesheet" type="text/css"  href="<c:url value="js/jquery-easyui-1.5.4.2/themes/ui-cupertino/easyui.css"/>"/>
<link  rel="stylesheet" type="text/css" href="<c:url value="js/jquery-easyui-1.5.4.2/themes/icon.css"/>"/>
<body>
<script type="text/javascript">
	
	$(function(){
		$('.tianjia').linkbutton({
			onClick:function(){
				$("#tianjia1").dialog("open");
			}
		})
		
		$("#question_clear").linkbutton({onClick:function(){
			//找到选中的行
			var row = $("#hhy_question_findAll_datagrid").datagrid("getSelected");
			if(!row){
				$.messager.alert('提示', '没有选中要删除的行！');
				return;
			}
			
			$.messager.confirm('确认', '真的要删除吗？', function(v){
				$("<form method = 'post'>").appendTo(document.body).form({
					url:'questionBank_delete',
					onSubmit:function(params){
						params["quId"] =row.quId;
					},success:function(v){
						v = eval("(" + v + ")");
						if(v.success){
							
							$.messager.alert('恭喜', '删除成功');
							$('#hhy_question_findAll_datagrid').datagrid('reload');
						}else{
							$.messager.alert('错误', '对不起，操作失败，原因：' + v.message);
						}
					}
				}).submit();

			});
		}});
		
	
		
		
	});		
</script>
<style type="text/css">
	.line{
		margin:5px 20px;
	}
</style>
	<table id="hhy_question_findAll_datagrid" class="easyui-datagrid" style="text-align:center;width:100%;" data-options="
		method:'post',
		fitColumns:true,
		url:'to_questionBank_findAll',
		fit:true,
		nowrap:false,
		autoRowHeight:true,
		rownumbers:true,
		singleSelect:true,
		pagination:true,
		pageList:[1,2,3,4],
		pageSize:1,
		striped:true,
		toolbar:'#question'
	">
		<thead>
			<tr>
				<th data-options="field:'quId',align:'center',width:'20'">编号</th>
				<th data-options="field:'quName',align:'center',width:'20'">名称</th>
				<th data-options="field:'defideName',align:'center',width:'20'">部门</th>
				<th data-options="field:'numberRadio',align:'center',width:'15'" value="0">单选数</th>
				<th data-options="field:'numberMultiple',align:'center',width:'15'" value="0">多选数</th>
				<th data-options="field:'numberJudge',align:'center',width:'15'" value="0">判断数</th>
				<th data-options="field:'compositeNumber',align:'center',width:'15'" value="0">综合题</th>
				<th data-options="field:'quRemark',align:'center',width:'20'">备注</th>
				<th data-options="field:'quBlockup',align:'center',width:'20'">停用</th>
				<th data-options="field:'quPerson',align:'center',width:'20'">创建者</th>
				<th data-options="field:'quDate',align:'center',width:'50',
				formatter:function(value,row,index){
					var date= new Date(value);
					return date.toLocaleString();
				}">创建日期</th>
				
			</tr>
		</thead>
		<tbody>
		</tbody>
	</table>
	<div id="question">
		<my:g id="153"><a href="#" class="easyui-linkbutton tianjia" data-options="iconCls:'icon-add',plain:true,text:'添加'"></a></my:g>
		<my:g id="155"><a href="#" class="easyui-linkbutton" id="question_clear" data-options="iconCls:'icon-clear',plain:true,text:'删除'"></a></my:g>
		搜索文本  <input id="bir" class="easyui-searchbox" data-options="width:100,
		searcher:function(value,name){
				$('#suosuos').datagrid('load','questionBank_query?quName='+value);
			}">
		<a id="btn" class="easyui-linkbutton" data-options="width:60,plain:false,text:'搜索'"></a> 
	</div>
	<div class="easyui-dialog" id="tianjia1" data-options="width:350,height:300,title:'题库',
				modal:true,
				closed:true,
				buttons:[{
					text:'确定',
					iconCls:'icon-ok',
					handler:function(){
					$('#hhy_question_insert').form({    
						url:'to_questionBank_insert',
						onSubmit: function(v){
						   
						},    
						success:function(s){

							s = eval('('+s+')');
							if(s.success){
								$('#tianjia1').dialog('close');
								$('#hhy_question_insert').form('reset');
								$('#hhy_question_findAll_datagrid').datagrid('reload');
							}else{
								$.messager.alert('错误', '对不起，操作失败，原因：'+s.message);
							}
						}
					}).submit();
				}	
				},{
					text:'取消',
					iconCls:'icon-clear',
					handler:function(){
						$('#tianjia1').dialog('close');		
					}
				}]">
			<form action="" method="post" id="hhy_question_insert">
					<div class="line">
						<input class="easyui-textbox" id="quName" name="quName" data-options="label:'*名称',width:280,height:25,labelWidth:80"/>
					</div>
					<div class="line">
						<select name="defideName" id="defideName" class="easyui-combobox" data-options="label:'部门',width:280,height:25,panelHeight:'auto',labelWidth:80,editable:false">
							<c:forEach items="${defideName}" var="dn">
								<option >${dn.defideName}</option>
							</c:forEach>
						</select>
					</div>
					<div class="line">
						<input class="easyui-textbox" name="quRemark" data-options="label:'备注',width:280,height:50,labelWidth:80"/>
					</div>
					<div class="line">
							<select id="quBlockup" name="quBlockup" class="easyui-combobox"  data-options="label:'停用',width:280,height:25,panelHeight:'auto',labelWidth:80,editable:false">
								<option value="是">是</option>
								<option value="否">否</option>
							</select>
					</div>
			</form>
			</div>
</body>
</html>